home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 3896 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.1 KB  |  39 lines

  1. Path: naic.wpafb.af.mil!kda36
  2. From: kda36@naic.wpafb.af.mil (Keith D. Anthony - NAIC/TATA - 513-257-6351)
  3. Newsgroups: comp.lang.c
  4. Subject: E-mail from within a Program
  5. Date: 31 Jan 1996 19:09:34 GMT
  6. Organization: Wright Patterson AFB
  7. Distribution: world
  8. Message-ID: <4eoepe$kov@serveru1.naic.wpafb.af.mil>
  9. NNTP-Posting-Host: swtch91u.naic.wpafb.af.mil
  10.  
  11.  
  12. I'm attempting to write code that generates a file, probably
  13. in /tmp, e-mails this file to a userid, and does all this for 
  14. a list of users.
  15.  
  16. Have tried as a first attempt:
  17.  
  18. char *arg1[7];
  19.  
  20. arg1[0] = "mail";
  21. arg1[1] = "-s";
  22. arg1[2] = "test message";
  23. arg1[3] = "userid";
  24. arg1[4] = " < "        /* have even tried \<*/
  25. arg1[5] = "/tmp/filename";
  26. arg1[6] = NULL;
  27.  
  28. (sending to myself) I get a blank message and another one
  29. apparently going to "< userid".  
  30.  
  31. Do I need to manipulated some file descriptors?  
  32. Anyone done something like this?  Can anyone offer some code
  33. to e-mail files under program control (yes, in C).
  34.  
  35. Oh yes, this is the generic C compiler under SUNOS 4.1.3.
  36.  
  37. Thanks, and please e-mail any suggestions.  I happily summarize
  38. and repost.
  39.